Repository navigation
Conversation
clean-uninstall.ps1 only matched the startup tasks, so Companion's per-user Gateway cleanup task and its folder survived a full cleanup. The armed task could also unregister a WSL distro the plan said it would preserve, and deleting the leftover folder by hand orphaned the task for good. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs real behavior proof before merge. What this changesThe PR removes owned Gateway cleanup tasks and their files during confirmed clean uninstall. Example: Clean uninstall encounters the legacy cleanup task for OpenClawFoundation.OpenClaw_rfcbke2p71se2.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 5 items remain Keep open: this maintainer-authored PR addresses a verified omission in main's uninstall path, distinct from the merged windowless-launch fix. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe standalone PowerShell cleanup tool inventories current-user installations, tasks, profiles, and WSL storage, then applies explicitly confirmed removals with ownership and preservation checks. flowchart TD
A[Cleanup options and confirmation] --> B[Inventory packages tasks and files]
B --> C[Validate ownership and preserved storage]
C --> D[Native Gateway teardown]
D --> E[Unregister selected cleanup tasks]
E --> F[Remove packages and selected files]
F --> G[Verify removal and preservation]
Technical reviewBest possible solution: Keep task selection and revalidated removal in the existing guarded uninstall owner, preserving Dev scope and unrelated state. Do we have a high-confidence way to reproduce the issue? Main's exact startup-task filter and profile inventory omit the separately registered Gateway cleanup task and directory; the author also supplies live legacy-task selection evidence. Is this the best way to solve the issue? The smallest complete repair extends the existing uninstall inventory and guarded removal order; the patch follows that boundary without changing the installed cleanup worker. Full review comments:
Overall correctness: patch is correct AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 96ea36fe6066. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: in-process harness. SecurityNeeds attention: Source checks constrain deletion to owned identities, but their enforcement at the final scheduler effect still needs proof. EvidenceWhat I checked:
Likely related people:
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 6, 2026, 8:47 PM ET / November 7, 2026, 01:47 UTC. |
PR cleanup reviewReviewed head: This is not superseded by the windowless cleanup-host fix: main still omits these tasks and folders from clean-uninstall. The ownership checks, XML revalidation and ordering tests are useful. Before landing, please add current-head confirmed-apply evidence on a disposable Windows installation for both task forms, including foreign/replaced-task refusal and preservation of unselected Dev, WSL and unrelated data. The existing manual deletion establishes the cause of flashing but does not prove this script removed it. Please also keep the already-running-worker limitation explicit. Action in this cleanup pass: leaving this PR open. No branch changes or runtime-proof waiver. The findings above come from source, discussion and recorded-CI review; Windows validation was not rerun in this pass. |
|
This pull request has been automatically marked as stale due to inactivity. |
|
Closing due to inactivity. |
|
Hi @RomneyDa, I'm a Copilot triage agent helping the maintainers land PRs (I'm not Scott). The stale bot closed this, but the change is still useful, so I've reopened it. Thank you for your patience. Here is the confirmed-apply evidence asked for earlier, for head Windows Sandbox red/green. I seeded real scheduled tasks for the current SID: a production hosted cleanup-host task, a production legacy
Limits: the guest has no WSL and no real Companion install, so this doesn't prove that a preserved distro survives a running worker. Fresh CI is running on the current base; no changes to your branch are needed so far. |
…s task Acquire each cleanup family's cleanup.lock before any mutation and hold it while stopping and unregistering the task and ending waiting workers, so a running worker cannot unregister a preserved distro. Match legacy task arguments exactly and recheck task XML case-sensitively. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Hi, Copilot triage agent here (not Scott). I pushed a small follow-up (b722629) for the review findings:
Tests: |
…emoval, and kill only exact workers Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Hi, Copilot triage agent here (not Scott). A follow-up from review is pushed (9d189ac):
|
… and match the host's family Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Hi, Copilot triage agent here (not Scott). I pushed a small follow-up (86fad95) that fixes the last review findings:
|
|
Hi, Copilot triage agent here (not Scott). I ran a Windows Sandbox red/green for 86fad95 (network off, real processes). The harness started a real system PowerShell worker with Companion's exact direct-launch command line: |
… matching, kill by held handle - Delete owned.json while the cleanup lock is still held, so a worker that starts after the scan has nothing to act on. - Anchor host and worker command-line matches at the executable token and an allowlisted option prefix, so script text inside another argument (for example -Command) is never treated as a worker. - Pin the PID with a process handle before the identity check and kill through that handle instead of Stop-Process -Id. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Hi, Copilot triage agent here (not Scott). I pushed one more small commit (20a32ab) to address the last review round:
Proof: |
…nup folders Retire owned.json under lock before any package removal so a run that fails after removal begins never releases the lock with the record intact. Refuse cleanup folders that appeared after the preview or are reparse points, and require a quoted worker script path when it contains whitespace. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Hi, Copilot triage agent here (not Scott). One more small round, pushed as 520cf44:
Each fix has a test that fails without it. |
|
Hi, Copilot triage agent here (not Scott). Here's an update on Sandbox red/green (network off, Windows PowerShell 5.1, no WSL in the guest). A real late-worker process uses the same
The local regression suite passes 54/54. Each new test fails with its fix reverted. Review at this head: two reviewers voted to land and one voted to hold, so this stays on hold for now. The open points:
None of this needs action from you tonight. A maintainer will pick it up. Thank you for your patience with all the rounds on this one. |
Related: #1887
What Problem This Solves
Fixes: a console window keeps flashing and taking focus every minute after a full
clean-uninstall.ps1when Companion's Gateway cleanup task and folder are left behind.User Impact
User impact: a clean uninstall now removes the Gateway cleanup task and its files, so nothing keeps running afterwards, and a WSL distro the plan says it will preserve can no longer be unregistered by that task.
This does not fix the Store-build flashing reported in #1887, which needs #1782 to reach the Store. It also does not repair machines that already have an orphaned task until cleanup is run again.
Why This Change Was Made
clean-uninstall.ps1only selected tasks named exactlyOpenClaw Companion, soOpenClaw Gateway cleanup - <SID> - <family>survived, and so did~\.openclaw-companion. Removing that folder by hand left a task that could neither run nor unregister itself.The task is now selected by exact identity (SID, family, root path, principal and action, for both the windowless host and the older PowerShell action) and fails closed on anything else. It deliberately does not depend on the task's files, because orphaned tasks have none. It is removed after native teardown and before package removal: the task reacts to package removal, and leaving it armed through teardown failures would be the worse outcome. Dev families still require
-IncludeDev.Tradeoffs
Remove-AppxPackagefails after the task is removed, it stays disarmed until Companion next starts, which re-registers it fromowned.json. The script already reports partial cleanup.cleanup.ps1unregister itself whenowned.jsonis missing and dropped it.DeployAsyncis skipped without a record, so existing installs would never receive it, and it added a race with concurrent registration.Evidence
On an ARM64 machine with this orphaned task, a read-only dry run of this branch selected the real legacy task. Before the task was removed, a window hook recorded 6 of 6 task runs opening a Windows Terminal window that took focus for about 0.35s, with matching PIDs. No console window appeared in the 3 minutes after removal.
Change Type
Scope
winnodeRequired proof pools
none: this changes only the standaloneclean-uninstall.ps1tool and its docs, not installed product behavior.Validation
scripts/test-clean-uninstall.ps1: 51 passed, up from 48 onmain, run again on the rebased head.scripts/validate-docs.ps1: passed, 72 Markdown files checked.dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj: 4862 passed, 3 failed, 26 skipped.CleanUninstallScriptTestspassed.dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj: 5243 passed, 9 failed.mainon this machine. The 9 Tray failures and 2 Shared failures are PowerShell 7 not being installed, and the other is the missing symlink privilege. None touch this change../build.ps1: passed on an earlier revision of this branch. The final diff has no compiled inputs.Real Behavior Proof
c1df1782for the regression suite. The dry run and full test runs used earlier working trees with the same or a supersededclean-uninstall.ps1, as noted below..\scripts\clean-uninstall.ps1 -All -ExcludeCachedModels, without-ConfirmDestructive.N/ASecurity Impact
NoNoNoNoYesYes, explain the risk and mitigation: cleanup now deletes one more scheduled task per selected family and~\.openclaw-companion\cleanup\<family>. Both are selected by exact identity, unexpected ownership stops the run, the existing path guards apply, and parent folders are removed only when empty. All of it appears in the dry-run plan.Compatibility and Migration
YesNoNoReview Conversations
🤖 Generated with Claude Code